package indi.zhifa.study2024.generaltest.util;

import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZoneOffset;

public class TimeUtil {
    public static Long LocalDateTimeToSecond(LocalDateTime localDateTime){
        return localDateTime.toEpochSecond(ZoneId.of("Asia/Shanghai").getRules().getOffset(localDateTime));
    }

    public static LocalDateTime parseFromSecond(Long pSecond){
        return LocalDateTime.ofEpochSecond(pSecond, 0, ZoneOffset.ofHours(8));
    }
}
